package yi;

import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;

public class DataStream
{
    public static void main(String args[]) throws  IOException
    {
        FileOutputStream fos = new FileOutputStream("a.txt");
        DataOutputStream dos = new DataOutputStream (fos);
        try
        {
            dos.writeInt(1);
            dos.writeChars("张三");
            dos.writeInt(19);
            dos.writeDouble(65);
        }
        finally
        {
            dos.close();
        }
        FileInputStream  fis = new FileInputStream("a.txt");
	DataInputStream dis = new DataInputStream(fis);
	try
	{
	    System.out.println("\t "+dis.readInt());
	    System.out.println("\t "+dis.readLine());
	    System.out.println("\t "+dis.readInt());
	    System.out.println("\t "+dis.readDouble());
	}
	finally
	{
	    dis.close();
	}
   }//main()
}//class DataStream

